package com.smart.tool.functionchain;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author xiaoqiang
 * @Version SmartFunctionContext.java, v 0.1 2025年09月06日 12:45 xiaoqiang
 * @Description: TODO
 */
public class SmartFunctionContext {
    public final Map<String, Object> context = new HashMap<>();

    private int index = 0;

    private Object preResult;

    private SmartFunctionContext(int index, Object preResult) {
        this.index = index;
        this.preResult = preResult;
    }

    public static SmartFunctionContext of(  int index, Object preResult) {
        return new SmartFunctionContext(index, preResult);
    }

    public Object getPreResult() {
        return preResult;
    }

    public int getIndex() {
        return index;
    }

    public Map<String, Object> getContext() {
        return context;
    }

    public void put(Map<String, Object> map){
        context.putAll(map);
    }

    public void put(String key, Object value) {
        context.put(key, value);
    }

    public Object get(String key) {
        return context.get(key);
    }

}
